<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of previewpdf
 *
 * @author loind
 */
class Preview extends CI_Controller{
   public $outputData ='';
    public function __construct() {
        parent::__construct();
        $this->load->model('Item_model','itemEntry');
    }
    function index() {
        
    }
    function previewpdf() {
        
        $session_id = $this->session->userdata('session_id');
       // $category_Id = $this->uri->segment(3);
        
       if($this->session->userdata('logged_in')) {
        //User is logged in
            $this->outputData['category_1'] = $this->itemEntry->get_top_five_entries_by_categoryId_UserId(1);
            $this->outputData['category_2'] = $this->itemEntry->get_top_five_entries_by_categoryId_UserId(2);
            $this->outputData['category_3'] = $this->itemEntry->get_top_five_entries_by_categoryId_UserId(3);
            $this->outputData['category_4'] = $this->itemEntry->get_top_five_entries_by_categoryId_UserId(4);
            $this->outputData['category_5'] = $this->itemEntry->get_top_five_entries_by_categoryId_UserId(5);
        } else {
        //User is not logged in
            $this->outputData['category_1'] = $this->itemEntry->get_top_five_entries_by_categoryId_SessionId(1,$session_id);
            $this->outputData['category_2'] = $this->itemEntry->get_top_five_entries_by_categoryId_SessionId(2,$session_id);
            $this->outputData['category_3'] = $this->itemEntry->get_top_five_entries_by_categoryId_SessionId(3,$session_id);
            $this->outputData['category_4'] = $this->itemEntry->get_top_five_entries_by_categoryId_SessionId(4,$session_id);
            $this->outputData['category_5'] = $this->itemEntry->get_top_five_entries_by_categoryId_SessionId(5,$session_id);
        } 
       
	//print_r($this->outputData['homeRows']);
        
        //$this->load->view('previewpdf', $this->outputData);
        $this->load->view('preview/preview', $this->outputData);
        
    }
}

?>
